Release 10.1A: OpenEdge Data Management:
DataServer for Microsoft SQL Server
Using ROWID with RUN STORED-PROCEDURE and LOAD-RESULT-INTO
In the previous section, Example 3–23 assumes you migrated your database to MS SQL Server using the
Note: If you used a different single-component index to load theCREATE RECID FIELD option, as discussed in the "ROWID characteristics" section. Example 3-24 and all subsequent examples in this section show ROWID as being represented by the 4-byte integer value of theProgress_RECIDcolumn as opposed to some other unique single-component index designated in your database to be the Progress recid.ROWIDof a temp-table, you would need to map the column accordingly, just as the example mapsPROGRESS_RECID.The RUN STORED-PROC command has no native awareness that the MSS Database Table is being queried for the result set(s) it generates. Therefore, to allow DataServer technology to convert the stored
PROGRESS_RECIDvalue into a native ProgressROWIDvalue, the physical name of the target database table needs to be known. To achieve this bond, the temp-table that the stored procedure will populate must be associated with an OpenEdge ProDataSet object.Example 3–24 shows a 4GL query filling the temp tables of a ProDataSet. It will be used as the baseline code which will be referenced throughout the remainder of this section.
Example 3–24: 4GL Query filling a ProDataSet temp-tableExample 3–25 combines code from Example 3–23 and Example 3–24 by applying the results of the RUN STORED-PROC [LOAD-RESULT-INTO] technique, rather than a 4GL query, to fill the temp-table associated with a ProDataSet.
Example 3–25: Using the LOAD-RESULT-INTO technique to populate the underlying Temp-Table of a ProDataSetKeep the following key points in mind as you review Example 3–25:
- The
TEMP-TABLEfield that is mapped to thePROGRESS_RECIDcolumn should be changed from its standard definition ofINTEGERtoROWID.In Example 3–25, the result column location where
PROGRESS_RECIDis being returned has been namedtRecidin the temp-table. ThePROGRESS_RECID_IDENThas been renamedtRECID_ident. This renaming occurs in Example 3-26 because of the following line:
- The
TEMPTABLEmust be defined to the ProDataSet. The following line, another excerpted line of code from Example 3–25, shows this definition:
- The technique, demonstrated in Example 3–25, does not change the default behavior of the
ROWIDfunction, but provides a mechanism for theROWIDvalue to be stored along side its corresponding result rows; therefore, using theROWIDvalue to access database rows is unconventional with respect to the normal, or more typical, association betweenROWIDand a database table row. The following code demonstrates this difference.Default use of
ROWIDfunction on a record buffer, as excerpted from Example 3–25:
In contrast, the following code, another excerpt from Example 3–25, demonstrates an alternative use of the
ROWIDvalue with a temp-table:
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |